package com.fxcalibre.db.beans;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = "CREW")
@AssociationOverrides(
{ @AssociationOverride(name = "pk.mediaItem", joinColumns = @JoinColumn(name = "ITEM_ID")),
		@AssociationOverride(name = "pk.person", joinColumns = @JoinColumn(name = "PERSON_ID")) })
public class Crew extends HibernateBean
{

	private CrewPk pk = new CrewPk();
	
	public Crew()
	{
	}
	
	public Crew(CrewPk pk)
	{
		this.pk = pk;
	}

	@EmbeddedId
	public CrewPk getPk()
	{
		return pk;
	}

	public void setPk(CrewPk pk)
	{
		this.pk = pk;
	}

	public boolean equals(Object o)
	{
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Crew that = (Crew) o;

		if (getPk() != null ? !getPk().equals(that.getPk()) : that.getPk() != null)
			return false;

		return true;
	}

	public int hashCode()
	{
		return (getPk() != null ? getPk().hashCode() : 0);
	}

	@Override
	public void initialize()
	{

	}

}
